package com.hmyd.hmyd_android.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hmyd.hmyd_android.R;
import com.hmyd.hmyd_android.dto.ServiceQQ;


public class ExclusiveServiceAdapter extends BaseAdapter {
	private List<ServiceQQ> mdatas;
	private LayoutInflater mInflater;

	public ExclusiveServiceAdapter(Context context, List<ServiceQQ> datas) {
		this.mdatas = datas;
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return mdatas.size();
	}

	@Override
	public Object getItem(int position) {
		return mdatas.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		ViewHolder holder;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.view_exclusive_service, null);
			holder = new ViewHolder();
			holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
			holder.tv_introduction = (TextView) convertView.findViewById(R.id.tv_introduction);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		ServiceQQ item = mdatas.get(position);
		holder.tv_name.setText(item.name);
		holder.tv_introduction.setText(item.message);

		return convertView;
	}

	class ViewHolder {
		TextView tv_name;
		TextView tv_introduction;

	}

}
